<?php

namespace App\Kuafu\Shop\Model;

use App\Kuafu\Base\Model\BaseModel;
use App\Kuafu\Base\Model\Traits\KfSoftDeletes;
use App\Kuafu\Base\Model\Traits\KfUid;
use App\Kuafu\Common\Service\CommonService;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Kuafu\File\FileUtil;

class ShopArchives extends BaseModel
{
    use HasFactory, KfSoftDeletes, KfUid;

    protected $connection   = 'mysql';
    protected $modelCached  = true;
    public    $incrementing = false;

    protected $fillable = [
        'shopId',
        'wechat',
        'wechatUrl',
        'wechatPic',
        'eWechat',
        'eWechatUrl',
        'eWechatPic',
        'manageEWechatPic',
        'manageEWechatUrl',
        'createdAt',
        'updatedAt',
        'createdByUid',
        'updatedByUid',
        'minSelfDeliveryPrice',
        'selfDeliveryNotice',
        'isOpenSelfDelivery',
        'cameraStatus'
    ];

    public function setWechatPicAttribute($value)
    {
        $this->attributes['wechatPic'] = ossPublicRelativeFilePath($value);
    }

    public function getWechatPicAttribute($value)
    {
        return ossPublicFilePath($value);
    }

    public function setEWechatPicAttribute($value)
    {
        $this->attributes['eWechatPic'] = ossPublicRelativeFilePath($value);
    }

    public function getEWechatPicAttribute($value)
    {
        return ossPublicFilePath($value);
    }

    public function getManageEWechatPicAttribute($value)
    {
        return ossPublicFilePath($value);
    }

    public function setManageEWechatPicAttribute($value)
    {
        $this->attributes['manageEWechatPic'] = ossPublicRelativeFilePath($value);
    }

}
